
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>show</title>
    <link href="/css/bootstrap.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
</head>
<body>
<div align="center">
    <h3>SUCCESS</h3>
    <form method="get" id="form">
        <input type="number" name="id" id="aid" placeholder="请输入id">
        <input type="button" value="查询" onclick="query()">
    </form>
    <table border="1" width="300px" style="margin-top: 30px">
        <thead>
        <tr style="text-align: center;vertical-align:middle">
            <th>id</th>
            <th>name</th>
            <th>money</th>
        </tr>
        </thead>
        <tr id="account">
        </tr>
    </table>
</div>

</body>
<script>
    function query() {
        let id = $("#aid").val();
        console.log("id:", id)
        $.ajax({
            url: "/account/" + id,
            method: "get",
            type: "json",
            success: function (data) {
                console.log("结果：", data.id);
                $("#account").empty();
                $("#account").append("<td>" + data.id + "</td> <td>" + data.name + "</td><td>" + data.money + "</td>");
            }

        })
    }
</script>
</html>
